import { mapGetters } from 'vuex'

export const playerMixin = {
    mounted() {
        this.handlePlaylist(this.playlist)
    },
    activated() {
        this.handlePlaylist(this.playlist)
    },
    computed: {
        ...mapGetters(['playlist'])
    },
    watch: {
        playlist() {
            this.handlePlaylist(this.playlist)
        }
    },
    methods: {
        handlePlaylist() {
            throw new Error('component must implement handlePlaylist method')
        }
    }
}